/**
 * Meal 业务逻辑实现类
 * @author yanwl
 * @date 2014-08-23
 */
package com.chnbst.bstyun.service.impl;

import java.util.List;
import java.util.Map;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import com.chnbst.bstyun.core.base.BaseService;
import com.chnbst.bstyun.core.common.helper.DaoHelper;
import com.chnbst.bstyun.model.pojo.Meal;
import com.chnbst.bstyun.service.MealService;

@Transactional
@Service
public class MealServiceImpl extends BaseService implements MealService {
	
	//声明日志对象 logback
	private final static Logger logger = LoggerFactory.getLogger(MealServiceImpl.class);
	private final static String nameSpace = "com.chnbst.bstyun.mapper.MealMapper";
	
	@Transactional(propagation=Propagation.REQUIRED,readOnly=false)
	@Override
	public boolean deleteMeal(Integer mealId) {
		return DaoHelper.delete(nameSpace, "deleteMeal", mealId);
	}
	
	@Transactional(propagation=Propagation.REQUIRED,readOnly=false)
	@Override
	public boolean insertMeal(Meal meal) {
		return DaoHelper.insert(nameSpace, "insertMeal", meal);
	}
	
	@Transactional(propagation=Propagation.REQUIRED,readOnly=false)
	@Override
	public boolean updateMeal(Meal meal) {
		return DaoHelper.update(nameSpace, "updateMeal", meal);
	}
	
	@Transactional(propagation=Propagation.REQUIRED,readOnly=true)
	@Override
	public Meal selectMealByMealId(Integer mealId) {
		return (Meal)DaoHelper.query(nameSpace, "selectMealByMealId", mealId);
	}
	
	@SuppressWarnings("unchecked")
	@Transactional(propagation=Propagation.REQUIRED,readOnly=true)
	@Override
	public List<Meal> selectMeals(Map<String, Object> map) {
		return (List<Meal>)DaoHelper.list(nameSpace, "selectMeals", map);
	}
}
